package com.java.controller;

import com.java.dao.RepairsRecordsDao;
import com.java.entity.RepairsRecords;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * 报修记录(RepairsRecords)表控制层
 *
 * @author 安能
 * @since 2020-07-01 11:27:50
 */
@RestController
@RequestMapping("RepairsRecords")
public class RepairsRecordsController {


    @Resource
    private RepairsRecordsDao repairsRecordsDao;




    @GetMapping("insert")
    public RepairsRecords insert(RepairsRecords repairsRecords) {
        repairsRecordsDao.insert(repairsRecords);
        return repairsRecords;
    }

    @GetMapping("selectList")
    public HashMap<String, Object> selectList() {
        List<RepairsRecords> customers = repairsRecordsDao.selectList(null);
        HashMap<String, Object> map = new HashMap<>();
        map.put("code", 0);
        map.put("msg", "");
        map.put("count", customers.size());
        map.put("data", customers);
        return map;
    }
}